#import "RNEditListItemView.h"
#import "RNConstants.h"
#import "NSShadow+MCAdditions.h"

@implementation RNEditListItemView

@synthesize tagsField = tagsField_;

-(void)drawRect:(NSRect)frame {
    NSRect insetFrame = NSInsetRect([self bounds], RNDetailViewBorderPadding, RNEditListItemShadowRadius);
    NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:insetFrame xRadius:RNDetailViewCellCornerRadius yRadius:RNDetailViewCellCornerRadius];
    NSShadow *tagShadow = [[NSShadow alloc] initWithColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.7f] offset:NSMakeSize(0, 0) blurRadius:RNEditListItemShadowRadius];
    
    [NSGraphicsContext saveGraphicsState];
    [tagShadow set];
    [[NSColor blackColor] setFill];
    [border fill];
    [NSGraphicsContext restoreGraphicsState];
}

- (void)viewDidMoveToSuperview {
    if (![self superview])
        return;
    [[NSApp mainWindow] makeFirstResponder:[self tagsField]];
}

@end
